Telegram Group & Telegram Channel
Упаковка параметров с помощью urlencode

Довольно часто приходится работать с разнообразными API и совершать get-запросы с передачей множества параметров. Чаще всего составление запроса в коде выглядит примерно так:

url = 'https://example.com?item={}&size={}&color={}&amount={}'.format('t-shirt', 'M', 'white', 5)

Смотрится не слишком презентабельно, однако есть слегка более длинный, но значительно улучающий читаемость кода вариант – функция urlencode из модуля urllib.

Подписывайтесь на канал 👉@pythonofff



tg-me.com/pythonofff/2907
Create:
Last Update:

Упаковка параметров с помощью urlencode

Довольно часто приходится работать с разнообразными API и совершать get-запросы с передачей множества параметров. Чаще всего составление запроса в коде выглядит примерно так:

url = 'https://example.com?item={}&size={}&color={}&amount={}'.format('t-shirt', 'M', 'white', 5)

Смотрится не слишком презентабельно, однако есть слегка более длинный, но значительно улучающий читаемость кода вариант – функция urlencode из модуля urllib.

Подписывайтесь на канал 👉@pythonofff

BY Python академия




Share with your friend now:
tg-me.com/pythonofff/2907

View MORE
Open in Telegram


Python академия Telegram | DID YOU KNOW?

Date: |

What Is Bitcoin?

Bitcoin is a decentralized digital currency that you can buy, sell and exchange directly, without an intermediary like a bank. Bitcoin’s creator, Satoshi Nakamoto, originally described the need for “an electronic payment system based on cryptographic proof instead of trust.” Each and every Bitcoin transaction that’s ever been made exists on a public ledger accessible to everyone, making transactions hard to reverse and difficult to fake. That’s by design: Core to their decentralized nature, Bitcoins aren’t backed by the government or any issuing institution, and there’s nothing to guarantee their value besides the proof baked in the heart of the system. “The reason why it’s worth money is simply because we, as people, decided it has value—same as gold,” says Anton Mozgovoy, co-founder & CEO of digital financial service company Holyheld.

Telegram announces Anonymous Admins

The cloud-based messaging platform is also adding Anonymous Group Admins feature. As per Telegram, this feature is being introduced for safer protests. As per the Telegram blog post, users can “Toggle Remain Anonymous in Admin rights to enable Batman mode. The anonymized admin will be hidden in the list of group members, and their messages in the chat will be signed with the group name, similar to channel posts.”

Python академия from us


Telegram Python академия
FROM USA